package com.kk.base.entity.home;

import com.kk.base.annotion.ValidateEntity;
import com.kk.base.entity.BaseEntity;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;


/**
 * 前台用户地址中心实体类
 */
@Entity
@Table(name="address_center")
@EntityListeners(AuditingEntityListener.class)
@ToString
@Data
public class AddressCenter extends BaseEntity {

    @ManyToOne
    @JoinColumn(name="home_user_id")
    private HomeUser homeUser;  //所属前台用户

    @ValidateEntity(required=true, requiredLength =true,errorRequiredMsg="手机号不能为空!")
    @Column(name="mobile",nullable=false)
    private String mobile;//手机号

    @Column(name="landline",nullable=false)
    private String landline;//座机号

    @ValidateEntity(required=true, requiredLength =true,errorRequiredMsg="省不能为空!")
    @Column(name="province",nullable=false)
    private String province; //省

    @ValidateEntity(required=true, requiredLength =true,errorRequiredMsg="市不能为空!")
    @Column(name="city",nullable=false)
    private String city; //市

    @ValidateEntity(required=true, requiredLength =true,errorRequiredMsg="区不能为空!")
    @Column(name="district",nullable=false)
    private String district; //区

    @ValidateEntity(required=true, requiredLength =true,errorRequiredMsg="详细地址不能为空!")
    @Column(name="address",nullable=false)
    private String address; //详细地址

    @Column(name="home_user_type",nullable=false)
    private HomeUserTypeEnum homeUserType; //前台用户类型

}
